# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

from waflib import Utils

top = '..'

def build(bld):
    # precompiled headers (if enabled)
    bld(features=['cxx', 'pch'],
        name='tests-base',
        target='tests-base',
        headers=['../src/common-pch.hpp', 'boost-test.hpp'],
        use='ndn-cxx BOOST',
        includes='.')

    # core modules that can be shared between unit and integrated tests
    bld(features="cxx",
        target="boost-tests-base",
        source="key-chain-fixture.cpp identity-management-fixture.cpp",
        use='ndn-cxx tests-base BOOST',
        includes='.',
        install_path=None)

    # unit test objects
    unit_tests = bld(
        target="unit-test-objects",
        name="unit-test-objects",
        features="cxx",
        source=bld.path.ant_glob(['unit-tests/**/*.cpp'],
                                 excl=['**/*-osx.t.cpp', '**/*-sqlite3.t.cpp']),
        use='ndn-cxx tests-base BOOST',
        includes='.',
        defines='UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' %(bld.bldnode),
        install_path=None)

    if bld.env['HAVE_OSX_SECURITY']:
        unit_tests.source += bld.path.ant_glob('unit-tests/**/*-osx.t.cpp')

    # In case we want to make it optional later
    unit_tests.source += bld.path.ant_glob('unit-tests/**/*-sqlite3.t.cpp')

    # unit test app
    bld(features='cxx cxxprogram',
        target='../unit-tests',
        name='unit-tests-main-unit',
        source="main.cpp",
        use='ndn-cxx unit-test-objects boost-tests-base BOOST',
        install_path=None)

    bld.recurse('integrated')
